﻿// <copyright file="MetadataStore.cs" company="Microsoft Corporation">
// Copyright (c) 2009 Microsoft Corporation All Rights Reserved
// </copyright>
// <author>Michael S. Scherotter</author>
// <email>mischero@microsoft.com</email>
// <date>2009-06-04</date>
// <summary>MetadataStore class definition</summary>

namespace Contoso.WebAnalytics.Design
{
    using System.ComponentModel;
    using System.Windows.Controls;
    using Contoso.WebAnalytics.Design.Editors;
    using Microsoft.Windows.Design;
    using Microsoft.Windows.Design.Features;
    using Microsoft.Windows.Design.Metadata;

    /// <summary>
    /// Design-time metadata store
    /// </summary>
    public class MetadataStore : IProvideAttributeTable
    {
        #region IProvideAttributeTable Members

        /// <summary>
        /// Gets the attribute table for metadata about the Synergist.Analytics assembly
        /// </summary>
        public AttributeTable AttributeTable
        {
            get
            {
                AttributeTableBuilder attributeTableBuilder = new AttributeTableBuilder();

                attributeTableBuilder.AddCustomAttributes(
                    typeof(ContosoAnalytics),
                    new DescriptionAttribute(Properties.Resources.TrackEventsUsingCA),
                    new ToolboxCategoryAttribute(Properties.Resources.Analytics),
                    new EditorAttribute(typeof(ContosoAnalyticsCategoryEditor), typeof(ContosoAnalyticsCategoryEditor)));

                attributeTableBuilder.AddCustomAttributes(
                    typeof(ContosoAnalytics),
                    "Category",
                    new CategoryAttribute(Properties.Resources.ContosoAnlytics),
                    new DescriptionAttribute(Properties.Resources.CategoryDescription));

                attributeTableBuilder.AddCustomAttributes(
                    typeof(ContosoAnalytics),
                    "ProfileId",
                    new CategoryAttribute(Properties.Resources.ContosoAnlytics),
                    new DescriptionAttribute(Properties.Resources.ProfileIdDescription),
                    new DisplayNameAttribute(Properties.Resources.ProfileId));

                attributeTableBuilder.AddCustomAttributes(
                    typeof(ContosoAnalytics),
                    "NativeTracking",
                    new CategoryAttribute(Properties.Resources.ContosoAnlytics),
                    new DescriptionAttribute("Use native tracking instead of JavaScript.  This is required for Out-of-Browser applications."),
                    new DisplayNameAttribute("Native Tracking"));

                attributeTableBuilder.AddCustomAttributes(
                    typeof(ContosoAnalytics),
                    "TrackingCodeVersion",
                    new CategoryAttribute(Properties.Resources.ContosoAnlytics),
                    new DescriptionAttribute("The version of the Contoso Analytics tracking code."),
                    new DisplayNameAttribute("Tracking Code Version"));

                attributeTableBuilder.AddCustomAttributes(
                    typeof(ContosoAnalytics),
                    "Dispatch",
                    BrowsableAttribute.No);

                attributeTableBuilder.AddCustomAttributes(
                    typeof(ContosoAnalytics),
                    "Events",
                    BrowsableAttribute.No);

                attributeTableBuilder.AddCustomAttributes(
                    typeof(ContosoAnalytics),
                    "RequestType",
                    new CategoryAttribute(Properties.Resources.ContosoAnlytics),
                    new DisplayNameAttribute("Request Type"));

                return attributeTableBuilder.CreateTable();
            }
        }

        #endregion
    }
}
